package cn.wolfcode.trip.base.util;

import java.util.Calendar;
import java.util.Date;

/**
 * Copyright: Copyright (c) 2019 Super520
 * 描述：日期时间工具类
 *
 * @package: cn.wolfcode.trip.admin.controller
 * @author: Patch
 * @date: 2019/5/30 20:50
 * 总结:
 */
public abstract class DateUtil {
    /**
     * @param hour 需要推算的时间 正数表示将来，负数表示过去
     * @return
     */
    public static Date getTimeByHour(int hour) {

        Calendar calendar = Calendar.getInstance();

        calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) + hour);
        return calendar.getTime();
    }
}
